package com.dsl.dslallinone.common.config;

import com.dsl.dslallinone.dto.Granularity;
import com.dsl.dslallinone.dto.TimeWindow;
import io.swagger.v3.oas.annotations.media.Schema;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * 时间配置
 */
@Schema(description = "时间配置")
public class TimeConfig {
    @Schema(description = "时间窗口", required = true)
    @Valid
    @NotNull(message = "时间窗口不能为空")
    private TimeWindow window;

    @Schema(description = "时间粒度", required = true, example = "day")
    @NotNull(message = "时间粒度不能为空")
    private Granularity granularity;

    public TimeConfig() {}

    public TimeConfig(TimeWindow window, Granularity granularity) {
        this.window = window;
        this.granularity = granularity;
    }

    // Getters and Setters
    public TimeWindow getWindow() { return window; }
    public void setWindow(TimeWindow window) { this.window = window; }
    public Granularity getGranularity() { return granularity; }
    public void setGranularity(Granularity granularity) { this.granularity = granularity; }
}
